from django.contrib import admin
from .models import *

# Register your models here.
admin.site.register(Sentence)
admin.site.register(Tag)
# admin.site.register(Post)
admin.site.register(Comment)


@admin.register(Post)
class PostAdminModel(admin.ModelAdmin):
    # 编辑列表页
    list_display = [
        'title', 'author_', 'tag', 'pub_time', 'modify_time', 'img',
        'source', 'classify', 'look', 'zan', 'adv'
    ]
    # 编辑详情页
    fieldsets = [
        ("标题/正文", {"fields": ['title', 'content']}),
        ("分类/图片", {"fields": ['classify', 'img']}),
        ("作者/标签", {"fields": ['author', 'tags']}),
        ("广告位/点赞/围观次数", {"fields": ['adv', 'zan', "look"]}),
    ]
    # 过滤器
    list_filter = ["title", "author", "classify"]

    # 分页
    list_per_page = 3
